﻿<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true" CodeFile="QuanLyDonHang.aspx.cs" Inherits="Employee_QuanLyDonHang" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script type="text/javascript">
        $(document).ready(function(){
            var url="../Controllers/xlShowPill.aspx?viaType=employeepage";
           
            jQuery.get(url, function(data){
                $("#divPillContent").html(data);
            });
        });
        
        function DeletePill(idHoaDon)
        {
            var answer = confirm("Bạn muốn xóa hóa đơn?");
            if(answer == false)
                return;
            
            var url = "../Controllers/xlDelPill.aspx?btnDel=1&idHoaDon=" + idHoaDon;
            jQuery.get(url, function(data){
                $("#divPillContent").html(data);
            });
        }
        
        function UpdatePillState(idHoaDon)
        {
            var url = "../Controllers/xlShowUpdateBill.aspx?btnUpdate=1&idHoaDon=" + idHoaDon;
            jQuery.get(url, function(data){
                $("#divUpdatePill" + idHoaDon).html(data);
            });    
        }
        function ViewPillDetails(idHoaDon)
        {
            window.location = "HoaDonDetails.aspx?btnDetails=1&idHoaDon=" + idHoaDon;
        }
        
        function CloseDivUpdate(idHoaDon)
        {
            document.getElementById("divUpdatePill" + idHoaDon).innerHTML = "";
        }
        
        function DoUpdatePillState(idHoaDon)
        {
            var newState = $("#lstPillState" + idHoaDon).attr("value");
            var url="../Controllers/xlUpdatePill.aspx?btnDoUpdate=1&idHoaDon=" + idHoaDon + "&newState=" + newState;
           jQuery.get(url, function(data){
                if(data == "-1")
                    $("#divUpdatePill" + idHoaDon).html("<td align='center' class='invalidMessage' colspan='9'>Có lỗi xảy ra trong quá trình cập nhật Tình Trạng. Mời bạn thử lại hoặc liên hệ G3Group.</td>");
                else
                {
                    window.location = "QuanLyDonHang.aspx";
                }
            }); 
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table border="0" cellpadding="4" cellspacing="0" style="font-weight: bold" width="100%" >
        <tr>
            <td class="table_header">Quản lý đơn hàng</td>
        </tr>
        <tr>
            <td>
                <br/><br/>
                <div id="divPillContent"></div>
            </td>
        </tr>
        <tr>
            <td align="center">
                <asp:Button runat="server" ID="btnPrevious" Text="Trang chủ" 
                    onclick="btnPrevious_Click" />&nbsp;
            </td>
        </tr>
    </table>
</asp:Content>

